<template>
    <div>
        <headbar title="探索" 
        :right="true" 
        classright="el-icon-plus"
        @handleright="topublish()"></headbar>
        <div class="mar out">
            <windows 
            v-for="item in list" 
            :key="item.id" 
            :img="item.picture[0]" 
            :name="item.title" 
            :text="item.centent"
            @click.native = 'todetail(item)'
            ></windows> 
        </div>
    </div>
</template>

<script>
import axios from 'axios'
import windows from '@/components/windows.vue'
import headbar from '@/components/headbar.vue'
export default {
    components:{
        windows,
        headbar
    },
    data(){
        return{
            list:[]
        }
    },
    methods:{
        topublish(){
            this.$router.push('/publish')
        },
        todetail(item){
            this.$store.commit('changeWorldObj',item)
            this.$router.push('/detail')
        }
    },
    created(){
        axios('http://localhost:3000/exploration').then(res=>{
            console.log(res.data)
            this.list = res.data
        })
    }
}
</script>

<style lang="scss" scoped>
.out{
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}
</style>